package com.cloudatum.utils;

import com.alibaba.fastjson.JSON;
import com.cloudatum.util.HttpUtil;
import com.cloudatum.util.PropertiesUtil;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.HashMap;
import java.util.Map;

/**
 * 将下个活动推送到app
 * Created by Administrator on 2015/11/9.
 */
public class PushToApp {

    static Logger logger = LoggerFactory.getLogger(PushToApp.class);

    public static void push(Map map){
        String url = PropertiesUtil.getPropertiesStrWithCache("/noticeapp.properties","url",false);
        logger.debug(" ==> rushBuy income push to url:{}",url);

        if (null != map && StringUtils.isNotEmpty(url)) {
            logger.debug(" ==> rushBuy income push data {}", JSON.toJSONString(map));
            HttpUtil.httpPost(url, map);
        }
    }

    public static void main(String[] args) {
        Map<String,String> map = new HashMap<>();
        map.put("imgName","10.jpg");
        map.put("activityType","q");
        map.put("activityState","1");
        map.put("activityAddress","http://120.192.88.212/Orderform/ProductDisplay.aspx?ActivityID=43461082-2F19-436C-B1C3-5B5385E5A296");
        map.put("activityTime","2015-11-11 10:00:00");
        push(map);
    }

}
